<template>
  <div id="app">
    <div v-show="this.status==1?true:false">
      <HomeView></HomeView>
    </div>
   <!-- 引入子组件 定义一个on的方法监听子组件的状态-->
   
   <Login v-on:childByValue="childByValue" v-show="this.status!=1?true:false"></Login>
  </div>
</template>

<script>
import HomeView from './views/HomeView.vue';
import Login from './views/Login.vue';

export default{
  components:{HomeView,Login},
  data(){
    return{
      status:0,
      loginInfo:{}
    }
  },
  created(){
    this.status = sessionStorage.getItem("status")
    console.log("sssss"+this.status);
    
  },
  methods:{
    childByValue: function (childValue) {
        // childValue就是子组件传过来的值
        this.loginInfo = childValue
        console.log(this.loginInfo);
        this.status=this.loginInfo.code
        console.log("登录状态"+this.status);
        
        
      },
  }

}



</script>

<style scoped>

</style>
